/**
 * Created by Kuballle on 10/28/2014.
 */

coCaNgua.controller('mainLogin',['$scope','$location','myService',function($scope,$location,myService){

    $scope.players = [{name: "Tiểu Tử", img: "image/player1.png"},
        {name: "Hổ Báo", img: "image/player2.png"},
        {name: "Công Tử", img: "image/player3.png"},
        {name: "Lọ Lem", img: "image/player4.png"}];


    $scope.login = function(id){
        if(document.getElementById("selected").selectedIndex == 0){return;}
        myService.set(id);
        $location.path("/play");
    }


}])
    .factory('myService', function() {
        var savedData = {}
        function set(data) {
            savedData = data;
        }
        function get() {
            return savedData;
        }

        return {
            set: set,
            get: get
        }

    });